package cn.kust.apiuser.controller;

import cn.kust.apiuser.service.IUserService;
import cn.kust.microtourismcommon.pojo.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author WY
 * @data 2022/7/20 20:59
 **/
@RestController("/user")
public class UserController {
    @Autowired
    private IUserService userService;

    @GetMapping("/users")
    public ResponseResult getUser(HttpServletRequest request){
        //从http请求中获取accessToken
        String accessToken = request.getHeader("Authorization");

        // 根据accessToken解析出内容

        return userService.getUserByAccessToken(accessToken);

    }

}
